<%@ page import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.osee.administration.domain.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Stock首页</title>
<link rel="stylesheet" href="admin/styles/inner.css" type="text/css" />
<!--[if IE]><script language="javascript" type="text/javascript" src="admin/script/jqplot/excanvas.min.js"></script><![endif]-->
<link rel="stylesheet" type="text/css"
	href="admin/script/jqplot/jquery.jqplot.css" />


<script language="javascript" type="text/javascript"
	src="admin/script/jqplot/jquery-1.3.2.min.js"></script>

<script language="javascript" type="text/javascript"
	src="admin/script/jqplot/beautify.min.js"></script>
<script language="javascript" type="text/javascript"
	src="admin/script/jqplot/prettify.min.js"></script>
<link rel="stylesheet" href="admin/script/jqplot/jspec.min.css"
	type="text/css" media="screen" title="no title" charset="utf-8" />
<link rel="stylesheet" href="admin/script/jqplot/prettify.min.css"
	type="text/css" />

<script language="javascript" type="text/javascript"
	src="admin/script/jqplot/jquery.jqplot.min.js"></script>

<script language="javascript" type="text/javascript"
	src="admin/script/jqplot/jqplot.categoryAxisRenderer.min.js"></script>
<script language="javascript" type="text/javascript"
	src="admin/script/jqplot/jqplot.barRenderer.min.js"></script>

<script language="javascript" type="text/javascript">
	// nice unique id function generator which I don't use anymore.
	var uID = ( function() {
		var id = 1;
		return function() {
			return id++
		};
	})();

	function run() {
		var o, n, nid;

		var elems = $(".prettyprint.plot");

		for ( var n = 0; n < elems.length; n++) {
			var code = $(elems[n]).text();
			eval(code);
		}

		prettyPrint();
	}
</script>

</head>

<%
	List<Stock> sList = null;
	try {
		sList = (List<Stock>) request.getAttribute("sList");
	} catch (Exception e) {
		sList = new ArrayList<Stock>();
		e.printStackTrace();
	} finally {
		if (sList == null) {
			sList = new ArrayList<Stock>();
		}
	}
	
	StringBuilder line = new StringBuilder();
	StringBuilder serie = new StringBuilder();
	StringBuilder axe = new StringBuilder();
	
	for(Stock stock: sList){
		line.append(", " + stock.getQueryRecords().size());
		axe.append(", " + " \'" + stock.getName() + "\'");
	}
	for(int i = sList.size(); i < 10; i++){
		line.append(", ");
		axe.append(", " + "\' \'");
	}
	
	if(sList.size() != 0){
		line.deleteCharAt(0);
		axe.deleteCharAt(0);
	}
	
	sList = null;
%>
<body onload="run()">
<div id="inner-container">
	<div class="inner-block">
		<div class="bar-text">查询情况</div>
		<div class="inner-header">
			<div class="bar-c1"></div>
			<div class="bar-c2"></div>
		</div>
		<div class="inner-content">
			<div id="chart" style="width:504px"></div>
				<pre class="prettyprint plot" style="display:none"> 
				line = [<%=line %>];
				plot2 = $.jqplot('chart', [line], {
				    legend:{show:true, location:'ne', xoffset:55},
				    title:'',
				    seriesDefaults:{
				        renderer:$.jqplot.BarRenderer, 
				        rendererOptions:{barPadding: 8, barMargin: 8}
				    },
				    series:[
				        {label:'Stock'}
				    ],
				    axes:{
				        xaxis:{
				            renderer:$.jqplot.CategoryAxisRenderer, 
				            ticks:[<%=axe %>]
				        }, 
				        yaxis:{min:0}
				    }
				});
				</pre>
<div style="font-size:11px; margin-left:190px; margin-bottom:10px">被查询数前十的股票柱状图</div>
		</div>
	</div>
</div>
</body>
</html>
